package com.ruoyi.business;

import Ice.Communicator;
import Ice.InitializationData;
import Ice.ObjectAdapter;
import com.ruoyi.business.PortServerIce.callback.queryServant.disp.QueryServantImpl;
import com.ruoyi.business.PortServerIce.callback.trade.disp.TradeServantImpl;

/**
 * @Program:iceTest
 * @description:
 * @author: ronghaohua
 * @create: 2024-04-12 14:53:24
 **/
public class Server {
    public static void main(String[] args) {
        InitializationData initData = new InitializationData();
        Communicator communicator = Ice.Util.initialize(initData);

        try {
            ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("TradeServantAdapter", "default -p 60010");
            adapter.add(new TradeServantImpl(),communicator.stringToIdentity("TradeService") );

            adapter.add(new QueryServantImpl(),communicator.stringToIdentity("QueryService") );
            adapter.activate();


            System.out.println("Server is running...");
            communicator.waitForShutdown();
        } finally {
            communicator.destroy();
        }
    }
}